package com.xc.tjise.TJISE.day10;

public class MT4 implements Runnable {
    public static void main(String[] args) throws InterruptedException {
        Thread thread1 =new Thread(new MT4());
        thread1.setName("thread 1");
        Thread thread2 =new Thread(new MT4());
        thread2.setName("thread 2");
        Thread thread3 =new Thread(new MT4());
        thread3.setName("thread 3");


        thread1.start();
        thread2.start();



      try{
          thread2.join();
       }catch (InterruptedException e){
           e.printStackTrace();
        }

        thread3.start();
        System.out.println("test");

    }
    @Override
    public void run() {
        for (int i = 0; i < 3; i++) {
            System.out.println(Thread.currentThread().getName() +" is running =-=");
//            currentThread 返回当前正在执行的线程

        try {
            Thread.sleep(1000);
        }catch (InterruptedException e){
            e.printStackTrace();
        }
    }
    }
}
